package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);not null;"`
	Password string `gorm:"type:char(32);not null;"`
	Status   int64  `gorm:"type:tinyint(2);not null;"`
}

func (u *User) FindList(status int64) (list []*User, err error) {
	if status == 0 {
		DB.Debug().Find(&list)
	} else {
		DB.Debug().Where("status=?", status).Find(&list)
	}
	return
}
func (u *User) UpdateStatus(userid, status int64) error {
	return DB.Debug().Model(&User{}).Where("id=?", userid).Update("status", status).Error
}
